<?php
    defined('M2_MICRO') or die('Direct Access to this location is not allowed.');

    /**
      * @desc Front Controller class
      * @package M2 Micro Framework
      * @author Alexander Chaika
      */
    class FrontController extends Controller {
 
        public function dispatch($action = null, $task = null) {
            global $system, $error;

            // route action
            $method = $action.'Action';
            if (is_callable(array($this, $method))) {
                $result = $this->$method();
            } else {
                $result = $this->indexAction();
            }
            return $result;
        }

        private function indexAction() {
            $result = array(
                'title' => 'Dropbox for NiiAR.com',
                'header' => 'This is a Header',
                'body' => 'This is a Body',
                'footer' => 'This is a Footer',
            );

            return $result;
        }
    }
?>
